#include "singleSocket.h"

using std::string;

singleSocket* singleSocket::instancia = NULL;
string singleSocket::ip = "";
int singleSocket::port = 0;

singleSocket* singleSocket::getInstance(){
	if (instancia == NULL){
		instancia = new singleSocket;
	}
	return instancia;
}
void singleSocket::eliminar(){
	delete instancia;
	instancia = NULL;
}
bool singleSocket::isInstance(){
	return instancia!=NULL;
}

int singleSocket::conectar(const std::string& ip, int port){
	int b = instancia->Socket::conectar(ip,port);
	if (b>=0){
		singleSocket::ip = ip;
		singleSocket::port = port;
	}
	return b;
}
int singleSocket::conectar(){
	return instancia->Socket::conectar(singleSocket::ip,singleSocket::port);
}
singleSocket::singleSocket(){}
singleSocket::~singleSocket(){}
singleSocket::singleSocket(const singleSocket&){}
void singleSocket::operator=(const singleSocket&){}
